import request from '_utils/request'
// 请求分类接口
const fetchCate = (params = {}) => request.get('/shop/goods/category/all', { params })
// 商品详情页
const fetchItemList = (params = {}) => request.post('/shop/goods/list/v2', params)
// 详情页请求接口
const fetchItemDetail = (id) => request.post('/shop/goods/detail', { id })
// 注册接口
const doLogin = (params = {}) => request.post('/user/username/login', params)
// 登录接口
const doRegister = (params = {}) => request.post('/user/username/register', params)
// 请求购物车数据
const fetchCart = (params = {}) => request.get('/shopping-cart/info', { params })
// 购物车添加数据
const addItemCart = (params = {}) => request.post('/shopping-cart/add', params)
// 移除购物车商品
const delItemCart = (params = {}) => request.post('/shopping-cart/remove', params)
// 改变购物车商品数量
const changeItemNum = (params = {}) => request.post('/shopping-cart/modifyNumber', params)
// 修改购物车商品选中状态
const changeItemState = (params = {}) => request.post('/shopping-cart/select', params)
// 新增联系人
const addressAdd = (params = {}) => request.post('/user/shipping-address/add', params)
// 获取收获地址
const fetchAddress = (params = {}) => request.post('/user/shipping-address/list/v2', params)
// 修改收货地址
const updateAddress = (params = {}) => request.post('/user/shipping-address/update', params)
// 获取收货人详情
const fetchAddressInfo = (params = {}) => request.get('/user/shipping-address/detail/v2', { params })
// 删除联系人
const delContact = (params = {}) => request.post('/user/shipping-address/delete', params)
// 添加商品收藏
const addItemFavor = (params = {}) => request.post('/shop/goods/fav/add', params)
// 检测是否已收藏
const checkItemFavor = (params = {}) => request.get('/shop/goods/fav/check', { params })
// 获取收藏列表
const fetchFavorList = (params = {}) => request.post('/shop/goods/fav/list', params)
// 删除商品收藏
const delFavorItem = (params = {}) => request.post('/shop/goods/fav/delete', params)
// 查看用户详情
const getUserInfo = (params = {}) => request.get('/user/detail', { params })
// 修改用户信息
const setUserInfo = (params = {}) => request.post('/user/modify', params)
export {
  fetchCate,
  fetchItemList,
  fetchItemDetail,
  doLogin,
  doRegister,
  addItemCart,
  fetchCart,
  delItemCart,
  changeItemNum,
  changeItemState,
  addressAdd,
  fetchAddress,
  updateAddress,
  fetchAddressInfo,
  delContact,
  addItemFavor,
  checkItemFavor,
  fetchFavorList,
  delFavorItem,
  getUserInfo,
  setUserInfo
}
